package com.group9.handinhand.dao.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.group9.handinhand.service.so.TagSO;

@Entity
@Table(name = "TAG")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Tag extends AbstractBaseModel {
	
	private static final long serialVersionUID = 1L;
	
	@Column(name = "TAGNAME", nullable = false, length = 100)
	private String tagName;
	
	@ManyToOne
	@JoinColumn(name = "SUPERIOR_TAG_ID")
	private Tag superiorTag;
	
	public TagSO convertToServiceObject() {
		TagSO so = (TagSO) convert(new TagSO());
		return so;
	}
			
	public String getTagName() {
		return tagName;
	}
	public void setTagName(String tagName) {
		this.tagName = tagName;
	}
	public Tag getSuperiorTag() {
		return superiorTag;
	}
	public void setSuperiorTag(Tag superiorTag) {
		this.superiorTag = superiorTag;
	}
	@Override
	public String toString() {
		return "Tag [tagName=" + tagName + ", superiorTag="
				+ superiorTag + "]";
	}
	
	
	
}
